perm filename LSPMAN.XGP[206,LSP] blob
sn#306071 filedate 1977-09-23 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BAXM30/FONT#2=BAXB30/FONT#3=SUB/FONT#4=SUP/FONT#5=NGR25/FONT#6=NGR20/FONT#7=MATH30/FONT#9=GRK30/FONT#10=MS25/FONT#11=GRFX25/FONT#12=GRFX35
␈↓ ↓H␈↓α␈↓ ¬Organization of the Manual
␈↓ ↓H␈↓ This␈α⊃manual␈α⊃is␈α∩collected␈α⊃from␈α⊃several␈α∩sources␈α⊃and␈α⊃aims␈α∩to␈α⊃document␈α⊃those␈α∩features␈α⊃of
␈↓ ↓H␈↓MACLISP␈α⊂that␈α∂are␈α⊂available␈α∂in␈α⊂the␈α∂student␈α⊂version␈α∂of␈α⊂MACLISP␈α∂implemented␈α⊂at␈α⊂LOTS␈α∂by
␈↓ ↓H␈↓R. Gabriel. The various sections of the manual are described below.
␈↓ ↓H␈↓1. ␈↓αLISP at LOTS␈↓
␈↓ ↓H␈↓ How␈α∂to␈α⊂invoke␈α∂the␈α⊂student␈α∂LISP␈α∂system␈α⊂at␈α∂LOTS.␈α⊂ Special␈α∂I/O␈α∂features.␈α⊂ The␈α∂log␈α⊂of␈α∂a
␈↓ ↓H␈↓sample session.
␈↓ ↓H␈↓2. ␈↓αMACLISP Reference Manual.␈↓
␈↓ ↓H␈↓ Contains␈αparts␈α1,␈α2,␈α3␈αand␈αthe␈αindices␈αof␈αthe␈αmanual␈αcurrently␈αin␈αproduction␈αat␈αMIT␈αunder
␈↓ ↓H␈↓the direction of Ellen Lewis. The initial page gives an index for the entire proposed manual.
␈↓ ↓H␈↓3. ␈↓αInput and Output.␈↓
␈↓ ↓H␈↓ This␈αsection␈αis␈αtaken␈αfrom␈αthe␈αI/O␈αsection␈αof␈αthe␈αold␈αMACLISP␈αReference␈αManual␈α
(written
␈↓ ↓H␈↓by␈α∂D.␈α∞Moon␈α∂at␈α∞MIT).␈α∂ It␈α∞includes␈α∂mainly␈α∞information␈α∂that␈α∞pertains␈α∂to␈α∞"Old␈α∂I/O"␈α∞which␈α∂is␈α∞the
␈↓ ↓H␈↓available form.
␈↓ ↓H␈↓4. ␈↓αThe LISP Editor.␈↓
␈↓ ↓H␈↓ This section contains the documentation for the Editor written by R. Gabriel and T. Finin.
␈↓ ↓H␈↓␈↓ ¬eLISP at LOTS␈↓ 91
␈↓ ↓H␈↓1. ␈↓αUsing LISP at LOTS␈↓
␈↓ ↓H␈↓ The␈α
following␈α
is␈α∞a␈α
brief␈α
introduction␈α
to␈α∞the␈α
use␈α
of␈α
the␈α∞"student"␈α
version␈α
of␈α∞MACLISP␈α
at
␈↓ ↓H␈↓LOTS.␈α⊂ This␈α⊂version␈α⊂can␈α⊃be␈α⊂run␈α⊂at␈α⊂LOTS␈α⊂ by␈α⊃typing␈α⊂ LISP␈α⊂to␈α⊂the␈α⊂"@"␈α⊃prompt.␈α⊂ Allocation,
␈↓ ↓H␈↓initialization␈α
of␈α
the␈α
Editor␈α
and␈α
other␈α
useful␈α
things␈α
are␈α
done␈α
automatically.␈α
As␈α
with␈α
other␈α
LISP
␈↓ ↓H␈↓interpreters,␈α
the␈α
top␈α
level␈α
is␈α
a␈α
read-eval-print␈αloop.␈α
Type␈α
in␈α
an␈α
S-expression␈α
and␈α
LISP␈αreturns
␈↓ ↓H␈↓the␈αvalue.␈α
To␈αexit␈αLISP␈α
type␈α↑C.␈α (↑␈α
in␈αfront␈αof␈α
a␈αcharacter␈αmeans␈α
to␈αdepress␈αthe␈α
<control>␈αkey
␈↓ ↓H␈↓while typing the character.)
␈↓ ↓H␈↓ This␈α
version␈α
of␈αMACLISP␈α
has␈α
the␈αI/O␈α
functions␈α
DSKIN␈αand␈α
DSKOUT␈α
which␈αare␈α
similar
␈↓ ↓H␈↓to␈α⊂the␈α⊂functions␈α⊃of␈α⊂the␈α⊂same␈α⊃name␈α⊂in␈α⊂LISP1.6.␈α⊃ To␈α⊂input␈α⊂a␈α⊃file␈α⊂named␈α⊂ FOO.BAR␈α⊃on␈α⊂your
␈↓ ↓H␈↓directory␈αsay␈α(DSKIN FOO BAR).␈α If␈αthe␈αfile␈αresides␈αon␈αone␈αof␈αthe␈αadditional␈αdirectories␈αknown
␈↓ ↓H␈↓to␈α
LISP␈α
then␈α∞(DSKIN FOO BAR <name>)␈α
will␈α
read␈α∞<name>FOO.BAR.␈α
One␈α
such␈α∞directory␈α
is
␈↓ ↓H␈↓CS206.␈α
Ask␈αa␈α
LISP␈α
hacker␈αto␈α
find␈α
out␈αothers.␈α
If␈α
the␈αfile␈α
resides␈α
on␈αa␈α
directory␈α
unknown␈αto␈α
LIPS
␈↓ ↓H␈↓then␈α∂the␈α∂form␈α∂of␈α∂the␈α∂instruction␈α∂is␈α∂(DSKIN FOO BAR DSK (m n))␈α∂where␈α∂(m n)␈α∂is␈α∂the␈α∂system
␈↓ ↓H␈↓account␈α
information␈αfor␈α
the␈αdirectory␈α
concerned.␈α
The␈αEditor␈α
functions␈αSAVE␈α
and␈α
REFILE␈αcan
␈↓ ↓H␈↓be␈αused␈αto␈αsave␈αor␈αupdate␈αfunction␈αdefinitions.␈αThe␈αfunction␈αDSKOUT␈αcan␈αbe␈αused␈αto␈αwrite␈αthe
␈↓ ↓H␈↓result␈α⊂of␈α⊃a␈α⊂computation␈α⊃on␈α⊂a␈α⊃file.␈α⊂ For␈α⊃example␈α⊂if␈α⊃FF␈α⊂is␈α⊃a␈α⊂function␈α⊃name␈α⊂and␈α⊃X␈α⊂is␈α⊃and␈α⊂S-
␈↓ ↓H␈↓expression␈α⊗then␈α∃(DKSOUT (PRINC (FF X)) FOO BAR)␈α⊗creates␈α⊗a␈α∃file␈α⊗FOO.BAR␈α⊗on␈α∃your
␈↓ ↓H␈↓directory␈αand␈α
PRINC's␈αthe␈αresult␈α
of␈αevaluating␈α(FF␈α
X)␈αon␈αthat␈α
file.␈α More␈αprimitive␈α
but␈αflexible
␈↓ ↓H␈↓I/O␈αfunctions␈αare␈αthe␈αusual␈αMACLISP␈α"old␈αI/O"␈αfunctions␈αUREAD/UWRITE␈αtogether␈αwith␈αthe
␈↓ ↓H␈↓appropriate␈αcontrol␈αswitches.␈α These␈αare␈αdescribed␈αin␈αthe␈αI/O␈αsection␈αof␈αthe␈αmanual.␈α The␈αsyntax
␈↓ ↓H␈↓for␈α"these␈α"functions␈α"is␈α" (UREAD <name> <ext>)␈α" for␈α"a␈α"file␈α"on␈α"your␈α"directory␈α!or
␈↓ ↓H␈↓(UREAD <name> <ext> DSK (m n)) for a file on the directory with account numbers (m n).
␈↓ ↓H␈↓ Sometimes␈αyou␈αmay␈αencounter␈αan␈αerror␈αand␈αa␈αbreakpoint␈αwill␈αoccur.␈α The␈αsystem␈αwill␈αtype
␈↓ ↓H␈↓a␈α
message␈α
preceded␈α
by␈α
a␈α
";"␈α
and␈α
perhaps␈α
give␈α
you␈α
the␈α
option␈α
of␈α
correcting␈α
the␈α
error␈α
on␈α
the␈α
fly.
␈↓ ↓H␈↓Usually␈αthe␈αinformation␈αthat␈α is␈αtyped␈αwill␈αalert␈α you␈αto␈αthe␈αcause␈αof␈αthe␈αerror;␈αif␈α not,␈αyou␈αshould
␈↓ ↓H␈↓read␈αabout␈α
errors␈αand␈α
debugging␈αaids␈α
in␈αthe␈α
manual.␈α In␈α
any␈αcase,␈α
to␈α get␈α
back␈αto␈α
the␈α toplevel␈α
of
␈↓ ↓H␈↓MACLISP you type: ↑G or (IOC G).
␈↓ ↓H␈↓2. ␈↓αA Sample Session with LISP at LOTS.␈↓
␈↓ ↓H␈↓ Things␈α∂typed␈α∂by␈α∂the␈α∂user␈α∂appear␈α∂in␈α∞␈↓↓THIS FONT␈↓␈α∂and␈α∂things␈α∂typed␈α∂by␈α∂LISP␈α∂appear␈α∞in
␈↓ ↓H␈↓␈↓¬THIS FONT.␈α
␈↓␈α
Instructions␈α
typed␈α
to␈αthe␈α
Editor␈α
are␈α
preceded␈α
by␈α
a␈α"←"␈α
which␈α
is␈α
the␈α
prompt␈α
used␈αby
␈↓ ↓H␈↓the␈α∀Editor.␈α∪ Messages␈α∀from␈α∪the␈α∀LISP␈α∀system␈α∪(such␈α∀as␈α∪error␈α∀messages)␈α∪are␈α∀preceded␈α∀by␈α∪";".
␈↓ ↓H␈↓Comments are preceded by the character "#".
␈↓ ↓H␈↓␈↓↓@LISP␈↓
␈↓ ↓H␈↓␈↓¬Student MacLisp Interpreter␈↓
␈↓ ↓H␈↓␈↓¬RIGHT! ␈↓
␈↓ ↓H␈↓␈↓ ¬eLISP at LOTS␈↓ 92
␈↓ ↓H␈↓# Type in an S-expression
␈↓ ↓H␈↓␈↓↓(QUOTE (A B C))␈↓
␈↓ ↓H␈↓# LISP returns the value
␈↓ ↓H␈↓␈↓¬(A B C) ␈↓
␈↓ ↓H␈↓# Try another. Note that 'A is short for (QUOTE A).
␈↓ ↓H␈↓␈↓↓(EQ 'A 'B)␈↓
␈↓ ↓H␈↓␈↓¬NIL ␈↓
␈↓ ↓H␈↓# Define a function
␈↓ ↓H␈↓␈↓↓(DEFUN FOO (X) (COND ((ATOM X) XX ) (T (FOO (CAR X)))))␈↓
␈↓ ↓H␈↓␈↓¬FOO ␈↓
␈↓ ↓H␈↓# Try it out
␈↓ ↓H␈↓␈↓↓(FOO '(A.B))␈↓
␈↓ ↓H␈↓␈↓¬;XX Unbound variable. Either type a value to use or ↑G:␈↓ ␈↓↓X␈↓
␈↓ ↓H␈↓# Oops! a misprint. Tell LISP that you really meant X and it will finish the evaluation.
␈↓ ↓H␈↓␈↓¬A ␈↓
␈↓ ↓H␈↓# Now use the Editor to fix the mistake.
␈↓ ↓H␈↓␈↓↓(EDIT FOO)␈↓
␈↓ ↓H␈↓# First prettyprint the current expression (CE).
␈↓ ↓H␈↓← ␈↓↓PP␈↓
␈↓ ↓H␈↓␈↓¬(DEFUN FOO (X) (COND ((ATOM X) XX) (T (FOO (CAR X)))))␈↓
␈↓ ↓H␈↓# Now point to the 2nd element of the 4th element of the CE
␈↓ ↓H␈↓← ␈↓↓4 2␈↓
␈↓ ↓H␈↓←
␈↓ ↓H␈↓← ␈↓↓PP␈↓
␈↓ ↓H␈↓␈↓¬((ATOM X) XX)␈↓
␈↓ ↓H␈↓# Replace the XX by the intended X
␈↓ ↓H␈↓␈↓ ¬eLISP at LOTS␈↓ 93
␈↓ ↓H␈↓← ␈↓↓(R XX X)␈↓
␈↓ ↓H␈↓← ␈↓↓P␈↓
␈↓ ↓H␈↓␈↓¬((ATOM X) X) ␈↓
␈↓ ↓H␈↓# Return to the top of the expression
␈↓ ↓H␈↓← ␈↓↓TOP␈↓
␈↓ ↓H␈↓# Print the "skeleton" of the expression
␈↓ ↓H␈↓← ␈↓↓P␈↓
␈↓ ↓H␈↓␈↓¬DEFUN FOO (X) (COND # #)) ␈↓
␈↓ ↓H␈↓# Save the definition on the file FOODEF.LSP in your directory
␈↓ ↓H␈↓← ␈↓↓SAVE␈↓
␈↓ ↓H␈↓␈↓¬<file-specification>:␈↓ ␈↓↓(FOODEF)␈↓
␈↓ ↓H␈↓␈↓¬(DSK (4 1381)) ␈↓
␈↓ ↓H␈↓# Leave the Editor and return to LISP
␈↓ ↓H␈↓← ␈↓↓EXIT␈↓
␈↓ ↓H␈↓␈↓¬NIL ␈↓
␈↓ ↓H␈↓# This mode of leaving the Editor forgets about the changes made to FOO, so
␈↓ ↓H␈↓# read in the definition written on FOODEF.LSP
␈↓ ↓H␈↓# (There are ways of getting the Editor to redefine the function using REMEMBER or OK)
␈↓ ↓H␈↓␈↓↓(DSKIN FOODEF LSP)␈↓
␈↓ ↓H␈↓␈↓¬FOO ␈↓
␈↓ ↓H␈↓␈↓¬DONE ␈↓
␈↓ ↓H␈↓# Try it
␈↓ ↓H␈↓␈↓↓(FOO '(A B))␈↓
␈↓ ↓H␈↓␈↓¬A ␈↓
␈↓ ↓H␈↓# Read from a previously created file on your directory called FOO.BAR.
␈↓ ↓H␈↓# It contains function definitions for ALT and ZEQUAL.
␈↓ ↓H␈↓␈↓↓(DSKIN FOO BAR)␈↓
␈↓ ↓H␈↓␈↓ ¬eLISP at LOTS␈↓ 94
␈↓ ↓H␈↓␈↓¬ALT ␈↓
␈↓ ↓H␈↓␈↓¬ZEQUAL ␈↓
␈↓ ↓H␈↓␈↓¬DONE ␈↓
␈↓ ↓H␈↓␈↓↓(ALT '(A B C D E))␈↓
␈↓ ↓H␈↓␈↓¬(A C E) ␈↓
␈↓ ↓H␈↓# Sesson is over. Return to EXEC
␈↓ ↓H␈↓␈↓↓↑C␈↓
␈↓ ↓H␈↓@